import React from 'react'
import {
  StyleSheet,
  Text,
  View,
  Button,
  AsyncStorage,
  TouchableOpacity,
  Image,
} from 'react-native';
import {Actions} from 'react-native-router-flux'
import { BaseButton } from 'react-native-gesture-handler';
import Icon from 'react-native-vector-icons/Ionicons'; 
import Icons from 'react-native-vector-icons/FontAwesome'; 

class PageThree extends React.Component { 
  constructor(props) { 
    super(props);
    this.state = {
      userName: 'SomeBody',
      phone:'13891759996',
    }
  }

  _removeData = async () => {
    try {
      await AsyncStorage.removeItem('userName');
      Actions.login();
    } catch (error) {
      console.log(error);
    }
  };
  
  render() { 
    var color = '#fff';
    return (
      <View style={styles.container}>
        <View style={styles.headBox}>
          <View style={styles.headerTop}>
            <Icons style={{color: color}} name='gear' size={22}/>
            {/* <Icon style={{color: color,marginLeft:10}} name='cog' size={26}/> */}
            <Icons style={{color: color,marginLeft:30}} name='bell-o' size={22}/>
          </View>
          <View style={styles.headerBottom}>
              <Image style={styles.headerPhoto}
                source={require('../images/portrait.jpg')}
            />
            <View style={styles.userInfo}>
              <Text style={styles.userName}>
                {this.state.userName}
              </Text>
              <Text style={styles.phone}>
                {this.state.phone}
              </Text>
            </View>
          </View>
        </View>
        <View style={styles.btnBox}>
          <View style={styles.btnItems}>
            <Text style={{color:'#444',fontSize:12}}>
              昵称
            </Text>
            <Text style={{color:'#ccc',fontSize:12}}>
              未设置
            </Text>
            {/* <Icon style={{color: '#000',marginLeft:30}} name='ios-arrow-forward' size={22}/> */}
          </View>
          <View style={styles.btnItems}>
            <Text style={{color:'#444',fontSize:12}}>
              性别
            </Text>
            <Text style={{color:'#ccc',fontSize:12}}>
              未设置
            </Text>
            {/* <Icon style={{color: '#000',marginLeft:30}} name='ios-arrow-forward' size={22}/> */}
          </View>
          <View style={styles.btnItems}>
            <Text style={{color:'#444',fontSize:12}}>
              位置
            </Text>
            <Text style={{color:'#ccc',fontSize:12}}>
              未设置
            </Text>
            {/* <Icon style={{color: '#000',marginLeft:30}} name='ios-arrow-forward' size={22}/> */}
          </View>
          <View style={styles.btnItems}>
            <Text style={{color:'#444',fontSize:12}}>
              关于我们
            </Text>
            <Icon style={{color: '#ccc',marginLeft:30}} name='ios-arrow-forward' size={22}/>
          </View>
          <View style={styles.btnItems}>
            <Text style={{color:'#444',fontSize:12}}>
              使用说明
            </Text>
            <Icon style={{color: '#ccc',marginLeft:30}} name='ios-arrow-forward' size={22}/>
          </View>
        </View>
        <TouchableOpacity
          onPress={this._removeData}
          style={styles.logoutTextView}
        >
          <Text
            style={styles.loginText}
          >
            退出登录
          </Text>
        </TouchableOpacity>
      </View>
    )
  }
}
const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#eee',
  },
  headBox: {
    // flexDirection: 'row',
    backgroundColor: '#0ECAC7',
    justifyContent: 'flex-start',
    // alignItems: 'center',
    height: 120,
  },
  headerTop: {
    flexDirection: 'row',
    justifyContent: 'flex-end',
    alignItems: 'center',
    paddingRight: 20,
    height: 40,
    // backgroundColor:'#fff',
  },
  headerBottom: {
    flexDirection: 'row',
    justifyContent: 'flex-start',
    alignItems: 'center',
    // backgroundColor: 'yellow',
    flex: 1
    // shadowColor: '#000',
    // shadowOffset: { height: 2, width: 2 },
    // shadowRadius:2,
  },
  headerPhoto: {
    borderRadius: 50,
    borderWidth: 3,
    borderColor: '#61d2c8',
    marginLeft: 20,
    width: 60,
    height: 60,
  },
  userInfo: {
    flex: 1,
    // backgroundColor: '#fff',
    justifyContent: 'flex-start',
    // alignItems: 'center',
    paddingLeft: 20,
  },
  userName: {
    fontSize: 14,
    color: '#fff',
    fontWeight: 'bold',
  },
  phone: {
    fontSize: 10,
    color: '#fff',
  },
  btnBox: {
    marginTop: 10,
    backgroundColor: '#fff',
    justifyContent: 'flex-start',
    paddingLeft: 10,
    paddingRight: 10,
  },
  btnItems: {
    flexDirection: 'row',
    justifyContent: 'space-between',
    alignItems: 'center',
    height: 40,
    paddingLeft: 5,
    paddingRight: 5,
    borderBottomWidth: 1,
    borderColor: '#eee'
  },
  logoutTextView: {
    height: 40,
    backgroundColor: "#0ECAC7",
    justifyContent: 'center',
    alignItems: 'center',
    borderColor: '#eee',
    borderWidth: 1,
    borderRadius: 5,
    marginLeft: 20,
    marginRight: 20,
    marginTop:50,
  },
  loginText: {
    fontSize: 14,
    color:'#fff',
  }
});

export default PageThree;